<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 * @version		$Id:$
 */

$this->headTitle($this->TRANSLATOR->translator('locale_config_page_title') . ' - ' . $this->TRANSLATOR->translator('common_admin_title'));
?>
<div class="content">
	<!--  -->
	<div class="box header mb0">
		<div class="head"><div></div></div>
		<h2 class="g_a_breadcump">
			<a class="fl" href="<?php echo $this->url('core_dashboard_index'); ?>"><?php echo $this->TRANSLATOR->translator('dashboard_breadcump', 'core'); ?></a>
			<small class="icon arrow_right" style="display: block;"></small>
			<a class="fl" href="javascript: void(0);"><?php echo $this->TRANSLATOR->translator('locale_config_breadcump'); ?></a>
			<div class="clear"></div>
		</h2>
	</div>
	<div class="desc">
		<div class="body">
			<form action="<?php echo $this->url('core_locale_config'); ?>" method="post" id="coreWebsiteConfig">
				<h4 class="g_a_h4 fl"><?php echo $this->TRANSLATOR->translator('locale_config_guide'); ?></h4>
				<div class="fr">
					<?php if ($this->ACL->isAllowed('config', 'locale', 'core')) : ?>
					<a class="fl g_a_tip form_submit g_a_submit_button mr5" href="javascript: void(0);" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('locale_button_save_title')); ?>"></a>
					<?php endif; ?>
					<a class="fl g_a_tip g_a_cancel_button mr5" href="javascript: history.go(-1);" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('common_back_button', 'core')); ?>"></a>
				</div>
				<div class="g_a_line"></div>
				<p>
					<label for="simple_input"><?php echo $this->TRANSLATOR->translator('website_config_web_language'); ?></label>
					<select name="default_language"  id="config_web_language">
						<?php if (isset($this->locales) && $this->locales) : ?>
						<?php foreach ($this->locales as $code => $locale) : ?>
						<option value="<?php echo $locale['code']; ?>"<?php if ($this->APP_LANG == $locale['code']): ?> selected="selected"<?php endif; ?>><?php echo $locale['localName']; ?> (<?php echo $locale['englishName']; ?>)</option>
						<?php endforeach; ?>
						<?php endif; ?>
					</select>
					<br>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<label><input type="checkbox" name="localization_enable" id="config_localization_enable" value="true"<?php if (isset($this->configs->localization->enable) && (string)$this->configs->localization->enable == 'true') : ?> checked="checked"<?php endif; ?> /><?php echo $this->TRANSLATOR->translator('locale_config_enable_multilingual'); ?></label>
				</p>
				<p class="small">&nbsp;</p>
				<p>
					<div id="localization"<?php if (!isset($this->configs->localization->enable) && (string)$this->configs->localization->enable == 'false') : ?> style="display: none;"<?php endif; ?>>
						<label for="simple_input"><?php echo $this->TRANSLATOR->translator('website_config_web_language'); ?></label><br />
						<div class="content">
							<?php foreach (array_values($this->locales) as $index => $locale) : ?>
							<?php if ($index % 3 == 0) : ?>
							<div class="clear"></div>
							<?php endif; ?>
							<div class="col w3">
								<input type="checkbox" name="supported_languages[]" value="<?php echo $locale['code']; ?>"<?php if (in_array($locale['code'], $this->availableLanguages)) : ?> checked="checked"<?php endif; ?> /> <img src="<?php echo $this->APP_STATIC_SERVER; ?>/images/flags/<?php echo $locale['code']; ?>.png" /> <span style="font-size: 12px;"><?php echo $locale['localName']; ?> (<?php echo $locale['englishName']; ?>)</span>
							</div>
							<?php endforeach; ?>
						</div>
					</div>	
				</p>
				<p class="small">&nbsp;</p>
				
				<div class="g_a_line"></div>
				<p class="last buttons_demo">
					<?php if ($this->ACL->isAllowed('config', 'website', 'core')) : ?>
					<a class="button form_submit green" href="<?php echo $this->url('core_website_config'); ?>"><small class="icon check"></small><span><?php echo $this->TRANSLATOR->translator('common_submit_button'); ?></span></a>
					<?php endif; ?>
					<a class="button red" href="javascript: history.go(-1);"><small class="icon cross"></small><span><?php echo $this->TRANSLATOR->translator('common_back_button'); ?></span></a>
				</p>
			</form>
			<div class="clear"></div>
		</div>
	</div>
	<div class="body_footer">
		<div class="bottom_left"><div class="bottom_right"></div></div>
	</div>
	<!--  -->
</div>
<script type="text/javascript">
$(document).ready(function() {
	<?php if (($string = $this->MESSENGER->printMessages()) != null) : ?>
	Gio.Message.success('<?php echo $string; ?>');
	<?php endif; ?>
	$('#config_localization_enable').change(function() {
		$('#localization').toggle();
	});
});
</script>